// StatusIndicator.qml
import QtQuick 2.15
import QtQuick.Controls 2.15
import QtQuick.Controls.Material 2.15
import QtQuick.Layouts 1.15

Rectangle {
    property string title: ""
    property string value: ""
    property string icon: ""
    property color statusColor: "#61dafb"
    property real progress: -1
    
    Layout.fillWidth: true
    Layout.fillHeight: true
    radius: 8
    color: "#2C313A"
    
    Column {
        anchors.centerIn: parent
        spacing: 10
        
        Image {
            source: icon
            anchors.horizontalCenter: parent.horizontalCenter
            width: 40
            height: 40
        }
        
        Text {
            text: title
            color: "#ABB2BF"
            font.pixelSize: 14
            anchors.horizontalCenter: parent.horizontalCenter
        }
        
        Text {
            text: value
            color: statusColor
            font.bold: true
            font.pixelSize: 16
            anchors.horizontalCenter: parent.horizontalCenter
        }
        
        // 电量进度条
        ProgressBar {
            visible: progress >= 0
            width: 120
            value: progress
            Material.accent: statusColor
            anchors.horizontalCenter: parent.horizontalCenter
        }
    }
}